{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# MNIST Dataset"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "A function that loads the `MNIST` dataset into NumPy arrays."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "> from mlxtend.data import mnist_data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Overview"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The MNIST dataset was constructed from two datasets of the US National Institute of Standards and Technology (NIST). The training set consists of handwritten digits from 250 different people, 50 percent high school students, and 50 percent employees from the Census Bureau. Note that the test set contains handwritten digits from different people following the same split.\n",
    "\n",
    "\n",
    "\n",
    "**Features**\n",
    "\n",
    "Each feature vector (row in the feature matrix) consists of 784 pixels (intensities) -- unrolled from the original 28x28 pixels images.\n",
    "\n",
    "\n",
    "- Number of samples: A subset of 5000 images (the first 500 digits of each class)\n",
    "\n",
    "\n",
    "- Target variable (discrete): {500x 0, ..., 500x 9}\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### References\n",
    "\n",
    "- Source: [http://yann.lecun.com/exdb/mnist/](http://yann.lecun.com/exdb/mnist/)\n",
    "- Y. LeCun and C. Cortes. Mnist handwritten digit database. AT&T Labs [Online]. Available: [http://yann.lecun.com/exdb/mnist](http://yann.lecun.com/exdb/mnist), 2010.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 1 - Dataset overview"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Dimensions: 5000 x 784\n",
      "1st row [   0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.   51.  159.  253.  159.   50.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.   48.  238.\n",
      "  252.  252.  252.  237.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.   54.  227.  253.  252.  239.  233.  252.   57.    6.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.   10.   60.  224.  252.  253.  252.  202.   84.  252.\n",
      "  253.  122.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.  163.  252.  252.  252.  253.\n",
      "  252.  252.   96.  189.  253.  167.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.   51.  238.\n",
      "  253.  253.  190.  114.  253.  228.   47.   79.  255.  168.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.   48.  238.  252.  252.  179.   12.   75.  121.   21.    0.    0.\n",
      "  253.  243.   50.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.   38.  165.  253.  233.  208.   84.    0.    0.\n",
      "    0.    0.    0.    0.  253.  252.  165.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    7.  178.  252.  240.   71.\n",
      "   19.   28.    0.    0.    0.    0.    0.    0.  253.  252.  195.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.   57.\n",
      "  252.  252.   63.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "  253.  252.  195.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.  198.  253.  190.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.  255.  253.  196.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.   76.  246.  252.  112.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.  253.  252.  148.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.   85.  252.\n",
      "  230.   25.    0.    0.    0.    0.    0.    0.    0.    0.    7.  135.\n",
      "  253.  186.   12.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.   85.  252.  223.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    7.  131.  252.  225.   71.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.   85.  252.  145.    0.    0.    0.\n",
      "    0.    0.    0.    0.   48.  165.  252.  173.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.   86.  253.\n",
      "  225.    0.    0.    0.    0.    0.    0.  114.  238.  253.  162.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.   85.  252.  249.  146.   48.   29.   85.  178.  225.  253.\n",
      "  223.  167.   56.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.   85.  252.  252.  252.  229.  215.\n",
      "  252.  252.  252.  196.  130.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.   28.  199.\n",
      "  252.  252.  253.  252.  252.  233.  145.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.   25.  128.  252.  253.  252.  141.   37.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.    0.\n",
      "    0.    0.    0.    0.]\n"
     ]
    }
   ],
   "source": [
    "from mlxtend.data import mnist_data\n",
    "X, y = mnist_data()\n",
    "\n",
    "print('Dimensions: %s x %s' % (X.shape[0], X.shape[1]))\n",
    "print('1st row', X[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Classes: Setosa, Versicolor, Virginica\n",
      "[0 1 2 3 4 5 6 7 8 9]\n",
      "Class distribution: [500 500 500 500 500 500 500 500 500 500]\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "print('Classes: Setosa, Versicolor, Virginica')\n",
    "print(np.unique(y))\n",
    "print('Class distribution: %s' % np.bincount(y))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2 - Visualize MNIST"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAWEAAAFyCAYAAAAkvWviAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAAPYQAAD2EBqD+naQAAGghJREFUeJzt3X+QXWWd5/H3Bw2CmSVMAAMOTsBBHdzdUdMqg4jghFpG\ndkR2p4rZFifqFMUgolTrlq6igrCMhYqJIxsLoQRcxh7jr0ERicoiGl1E0zorioMikYFA5Ic0IxIE\n8uwf56bsdDqdc7vv5em+eb+qbsE993vu/T45nU+ePr9uSilIkurYrXYDkrQrM4QlqSJDWJIqMoQl\nqSJDWJIqMoQlqSJDWJIqMoQlqSJDWJIqMoQ1MJJsSfKeGaz32s66y3rYy9lJtvTq/TS4DGG1luTw\nJGcl2at2L33Q6+v3y2zfM8lLkqxL8lCSu5J8OMnCHvWnOcIQVjdeArwH2Lt2I4MuyfOBrwF7ACPA\nxcApwJqafan3nly7Ac0raV2YBNi9lPJIH/sZZH8H3A8cVUp5CCDJL4CPJTmmlPK1qt2pZ5wJq5Uk\nZwHv7zzd0NmH+niSP+y8viXJ3yd5dZKbgM3AsUmO6rz2sknvt7SzfMWk5c9J8pkk9yV5OMl3k7xy\nhj3/YZLVSX6S5DdJ7k2yJsnSHayyMMlFnbrxJJcn2W7Wn+QVSb6R5NdJHkxyVZLntuhnn8749txJ\n3b8DjgH+99YA7vgE8BBw4s4+S/OHM2G19Vng2cB/A84A7ussv2dCzXKagLgQuBfYAPw+LfeNJvn3\nwDrgDuB9/C5w/inJfy2lXNllzy8C/hQY7bznQcBpwHVJnltK2Tzx4zt9/wo4C3hOp/YPgZdP6PGv\ngcuAa4C3AU8F3gB8M8kLSim3T9PPm2h25xwNfGOauv9I83dz/cSFpZRHk/wAeME062qeMYTVSinl\npiRjNCF85Q7C5tnAfyil/MvWBUmO6uJjPkwT3C8qpTzWWfbRJOuA84FuQ/iqUspnJy5I8kXgBuAv\ngX+YVL8ZWF5Kebx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asye+CbyilPLb2bUqSYOn2/OEW+2+KKWcDZw9\ng37UJxdffHHr2muuuaZ17Re/+MXWtYsXL25d2y+33377zosm6ObA8IYNG1rXbt68eedFHXvuuefO\nizr22muv1rXXXXdd69rnPOc5rWvVHW/gI0kVGcKSVJEhLEkVGcKSVJEhLEkVGcKSVJEhLEkVGcKS\nVJEhLEkVGcKSVJHftvwE6OaSzwMPPLB17R133NG69le/+lVfapcuXdq6di4opXRV33x3Qe91803H\nH//4x1vXnnDCCTNpRxU5E5akigxhSarIEJakigxhSarIEJakigxhSarIEJakigxhSarIEJakigxh\nSarIy5afAIcddljr2uXLl7euvfzyy2fSjuaASy65pHWtlyIPNmfCklSRISxJFRnCklSRISxJFRnC\nklSRISxJFRnCklSRISxJFRnCklSRISxJFRnCklSR946YY84///zWtVdeeWXr2gceeGAm7ezyzjjj\njNa1p59+euvagw46aAbdaBA5E5akigxhSarIEJakigxhSarIEJakigxhSarIEJakigxhSarIEJak\nigxhSaqoq8uWk7wD+C/AHwMPA98G3l5KuWVCzaXAayetek0p5bhZ9rpL2G+//VrX3nfffX3sRNIT\noduZ8JHAR4DDgGOABcBXkuw5qe7LwBJg/85jeJZ9StJA6momPHk2m+R1wC+BIWDdhJceKaXcM+vu\nJGnAzXaf8N5AAe6ftPzoJJuS/CTJ6iSLZ/k5kjSQZnwryyQBVgHrSik/nvDSl4HPArcBfwS8D7g6\nyeGllDKbZiVp0MzmfsKrgecCR0xcWEpZM+Hpj5L8ELgVOBq4bhafJ0kDZ0YhnORC4DjgyFLKXdPV\nllJuS3IvcAjThPDIyAiLFi3aZtnw8DDDwx7TkzR3jY6OMjo6us2y8fHx1uun2z0EnQB+FXBUKeXn\nLeoPBH4BvKqUctUUry8D1q9fv55ly5Z11YskzUVjY2MMDQ0BDJVSxqar7erAXJLVwEnAq4GHkizp\nPPbovL4wyfuTHJZkaZLlwD8BtwBrZzIYSRpk3Z4dcSqwF/B1YOOEx4md1x8H/gS4EvgX4GLgu8DL\nSimP9q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25e8S2xGglHIbzc/vvNiWSS4EjgOOLqXcNeGlgdh204xvO7W33ZwK4VLKo8B6YPnWZZ1fEZYD\n367VV78k+T2aDT/tD8l80/mhvpttt+NeNEesB247AiQ5ENiHebAtOwH1KuDlpZTbJ742CNtuuvHt\noL7qtpuLuyM+BFyWZD1wIzACPBW4rGZTvZDkA8AXaXZB/AHwXuBRYO59++BOdPZjH0IzawJ4ZpLn\nAfeXUv6VZl/cu5L8jOY2pefSnOVyZYV2uzbd+DqPs4DP0gTWIcD5NL/VrN3+3eaOJKtpTsc6Hngo\nydYZ73gpZeutZOftttvZ+DrbdW5tu9qnZ+zgtJLTaDb+w8D/BV5Yu6cejWuU5of5YeB24JPAwbX7\nmuFYjqI59efxSY+PT6g5m+Z0p9/Q/IAfUrvvXoyP5l6x19D8Jd4M/Bz4KLBf7b5bjGuqMT0OrJhU\nNy+33c7GNxe3nfcTlqSK5tQ+YUna1RjCklSRISxJFRnCklSRISxJFRnCklSRISxJFRnCklSRISxJ\nFRnCklSRISxJFf1/E0BQLkZBUz0AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x10502d240>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%matplotlib inline\n",
    "import matplotlib.pyplot as plt\n",
    "def plot_digit(X, y, idx):\n",
    "    img = X[idx].reshape(28,28)\n",
    "    plt.imshow(img, cmap='Greys',  interpolation='nearest')\n",
    "    plt.title('true label: %d' % y[idx])\n",
    "    plt.show()\n",
    "plot_digit(X, y, 4)       "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## API"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "## mnist_data\n",
      "\n",
      "*mnist_data()*\n",
      "\n",
      "5000 samples from the MNIST handwritten digits dataset.\n",
      "\n",
      "\n",
      "- `Data Source` : http://yann.lecun.com/exdb/mnist/\n",
      "\n",
      "\n",
      "**Returns**\n",
      "\n",
      "- `X, y` : [n_samples, n_features], [n_class_labels]\n",
      "\n",
      "    X is the feature matrix with 5000 image samples as rows,\n",
      "    each row consists of 28x28 pixels that were unrolled into\n",
      "    784 pixel feature vectors.\n",
      "    y contains the 10 unique class labels 0-9.\n",
      "\n",
      "**Examples**\n",
      "\n",
      "For usage examples, please see\n",
      "    [http://rasbt.github.io/mlxtend/user_guide/data/mnist_data/](http://rasbt.github.io/mlxtend/user_guide/data/mnist_data/)\n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "with open('../../api_modules/mlxtend.data/mnist_data.md', 'r') as f:\n",
    "    print(f.read())"
   ]
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  },
  "toc": {
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
